#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

class Solution
{
public:
    int Max(const vector<int> &v)
    {
        //将你的代码写在下面
        int n = 0;
        int flag = -1;
        for(int i = 0;i<v.size();i++)
        {
            int ret = v[i];
            if(ret < 0)
            {
                ret *= flag;
                if(n > ret)
                {
                    n = ret;
                }
            }
            if(ret > 0)
            {
                if(n < ret)
            {
                n = ret;
            }
            }
        }
        return n;
    }
};

#ifndef COMPILER_ONLINE
#include "Header.cc"
#endif

void Test1()
{
    vector<int> v = {1, 2, 3, 4, 5, 6};
    int max = Solution().Max(v);
    if (max == 6)
    {
        std::cout << "Test 1 .... OK" << std::endl;
    }
    else
    {
        std::cout << "Test 1 .... Failed" << std::endl;
    }
}

void Test2()
{
    vector<int> v = {-1, -2, -3, -4, -5, -6};
    int max = Solution().Max(v);
    if (max == -1)
    {
        std::cout << "Test 2 .... OK" << std::endl;
    }
    else
    {
        std::cout << "Test 2 .... Failed" << std::endl;
    }
}

int main()
{
    Test1();
    Test2();

    return 0;
}
